using MeetingManagement.Application.Common;
using MeetingManagement.Infrastructure;
using MeetingManagement.Infrastructure.Auth;
using MeetingManagement.Infrastructure.Common;
using Microsoft.EntityFrameworkCore;

namespace MeetingManagement.WebApi;

public static class ServiceCollectionExtensions
{
    public static IServiceCollection AddMeetingManagementPersistence(this IServiceCollection services, IConfiguration configuration)
    {
        services.AddDbContext<MeetingManagementDbContext>(options =>
            options.UseMySql(
                configuration.GetConnectionString("DefaultConnection"),
                ServerVersion.AutoDetect(configuration.GetConnectionString("DefaultConnection"))));
        services.AddScoped<IJwtTokenService, JwtTokenService>();
        services.AddScoped<IPasswordHasher, PasswordHasher>();
        return services;
    }
}
